<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var x = 20
      var a = {
        x: 15,
        fn: function() {
          var x = 30
          return function() {
            return this.x
          }
        }
      }
      console.log(a.fn()) // function() { return this.x }
      console.log(a.fn()()) // 20 => window.x this => window
      console.log(a.fn()()) // 20
      console.log(a.fn()() == a.fn()()) //true
      console.log(a.fn().call(this)) // 20
      console.log(a.fn().call(a)) // 15
    </script>
  </body>
</html>
